package com.my.study.jdbc.dao.impl;

import com.my.study.jdbc.dao.BookDao;
import com.my.study.jdbc.entity.BookEntity;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;

/**
 * @author Carlos
 * @version 1.0
 * @Description TODO
 * @date 2021/11/7 12:30
 **/
@Repository
public class BookDaoImpl implements BookDao {

    @Resource(name = "jdbcTemplateTwo")
    private JdbcTemplate jdbcTemplate;


    @Override
    public int update(BookEntity book) {
        String sql = "UPDATE book SET author = ? WHERE bookid = ?";
        return jdbcTemplate.update(sql, book.getAuthor(), book.getBookId());
    }
}
